<template>
    <div>
        <div class="singer-img">
            <img :src="singerSong1.avatar_s180" alt=""><br>
            <p>{{singerSong1.name}}</p>
            <div :style="{'background-image':'url('+singerSong1.avatar_s180+')'}"></div>
        </div>
    <ul>
        <li v-for="(item,index) in singerSong2" :key="index" @click="changeUrl(item.song_id)">
            <p>{{item.title}}</p>
        </li>
    </ul>
    </div>
</template>

<script>
    import {getSingerDetail} from "../api/api";

    export default {
        name: "singerSong",
        data(){
          return{
              singerSong1:[],
              singerSong2:[],
          }
        },
        created() {
            getSingerDetail(10,this.$route.query.songid).then(res=>{
                console.log(res);
                this.singerSong1 = res.artistinfo;
                this.singerSong2 = res.songlist;
            })
        },
        methods:{
            changeUrl(i){
                this.$router.push("/musicDetail?songId="+i)
            }

        }
    }
</script>

<style lang="less" scoped>

.singer-img{
    width: 100%;
    height: 190px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    position: relative;
    img{
        width: 100px;
        height: 100px;
        border-radius: 50%;
        z-index: 100;
        margin-top: 20px;
    }

    p{
        margin: 0;
        padding: 0;
        height: 30px;
        text-align: center;
        width: 100%;
        font-size: 24px;
        margin-bottom: 20px;
    }
    div{
        width: 100%;
        height: 100%;
        opacity: 0.2;
        background-size: 100% 100%;
        position: absolute;
        top: 0;
        left: 0;
    }
}
    ul{
        height: calc(100vh - 240px);
        overflow: scroll;
        li{
            height: 40px;
            line-height: 40px;
            margin: 0 10px;
            border-bottom: 1px solid #eeeeee;

        }
    }
</style>